#pragma once

#include <vector>

namespace solution_011
{

class Solution
{
public:
    int maxArea(const std::vector<int>& h)
    {
        int max = 0;
        for (int l = 0, r = h.size() - 1; l < r; ) {
            max = std::max(max, (r - l) * std::min(h.at(l), h.at(r)));
            if (h.at(l) < h.at(r))
                ++l;
            else
                --r;
        }
        return max;
    }
};

}  /* namespace solution_011 */
